package com.cy.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cy.common.pojo.JsonResult;
import com.cy.sys.pojo.SysDept;
import com.cy.sys.service.SysDeptService;

/**
 * 此类负责处理部门模块的请求
 * @author private
 *
 */
@RestController
@RequestMapping("/dept/")
public class SysDeptController {
	@Autowired
	private SysDeptService sysDeptService;
	
	/** 处理查询部门列表 */
	@RequestMapping("doFindObjects")
	public JsonResult doFindObjects() {
		return new JsonResult(sysDeptService.doFindObjects());
	}
	
	/** 获取部门节点数据 */
	@RequestMapping("doFindZTreeNodes")
	public JsonResult doFindZTreeNodes() {
		return new JsonResult(sysDeptService.doFindZTreeNodes());
	}
	
	/** 处理新增部门信息 */
	@RequestMapping("doSaveObject")
	public JsonResult doSaveObject(SysDept sysDept) {
		sysDeptService.doSaveObject(sysDept);
		return new JsonResult("insert ok");
	}
	
	/** 处理修改部门列表 */
	@RequestMapping("doUpdateObject")
	public JsonResult doUpdateObject(SysDept sysDept) {
		sysDeptService.doUpdateObject(sysDept);
		return new JsonResult("update ok");
	}
	
	/** 处理删除指定部门列表 */
	@RequestMapping("doDeleteObject")
	public JsonResult doDeleteObject(Integer id) {
		sysDeptService.doDeleteObject(id);
		return new JsonResult("delete ok");
	}
}
